﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Aim2.Screen;

namespace Aim2 {
    class HUD {
        public ScreenManager ScreenManager { get; set; }


        public HUD() {
        }

        public void Load(ContentManager content, Viewport viewport) {
        }

        public void Update(float elapsed) {
        }

        public void Draw(SpriteBatch spriteBatch, int score) {
            //DrawDebug();
            DrawScore(score);
        }

        private void DrawDebug() {
            Color color = Color.White;
            float scale = 1.0f;


            color = Color.Orange;
            string text = "State = " + Player.PlayerState.ToString() + " - Frame = " + Player.player.animatedSprite.Frame + " Texture = " + Player.CurrentSpriteTexture.Name;

            Vector2 origin = new Vector2(0, ScreenManager.ScoreFont.LineSpacing / 2);

            Vector2 size = ScreenManager.ScoreFont.MeasureString(text);
            ScreenManager.SpriteBatch.DrawString(ScreenManager.ScoreFont, text,
                                                 new Vector2(ScreenManager.GraphicsDevice.Viewport.Width - size.X, size.Y), color, 0, origin, scale,
                                                 SpriteEffects.None, 0);
        }

        private void DrawScore(int score) {
            Color color = Color.White;
            float scale = 1.0f;


            color = Color.Orange;
            string text = "SCORE : " + score.ToString().PadLeft(10, '0');

            Vector2 origin = new Vector2(0, ScreenManager.ScoreFont.LineSpacing / 2);

            Vector2 size = ScreenManager.ScoreFont.MeasureString(text);
            ScreenManager.SpriteBatch.DrawString(ScreenManager.ScoreFont, text,
                                                 new Vector2(ScreenManager.GraphicsDevice.Viewport.Width - size.X, size.Y), color, 0, origin, scale,
                                                 SpriteEffects.None, 0);
        }
    }
}
